import tpl from './tpl.html';
import './style.scss';
import NoData from '../../../../grsc-base/component/NoData.vue';
import Loading from '../../../../grsc-base/component/Loading.vue';
import service from './service';
import {
  PAGE_SIZE
} from '../../../../grsc-base/common/constants';
import Pager from '../../../../grsc-base/component/Pager.vue';
import filter from "../../../../grsc-base/util/filter";
import commonService from '../../../common/commonService';
export default Vue.extend({
  name: "freezingRecord",
  template: tpl,
  components: {
    NoData,
    Loading,
    Pager
  },
  data() {
    return {
      isLoadings: true,
      list: [],
      pageNo: 1,
      pageSize: PAGE_SIZE,
      pageNum: 0,
      filter,
      amountLockTypeList: [{
          value: 'INFLOW_COMPUT_POWER',
          label: '交易解锁'
        },
      ],
      amountLockType: 'INFLOW_COMPUT_POWER',
      amountType: 'UNFREEZE',
      amountCurrency: '',
      amountTypeList: [{
          value: 'UNFREEZE',
          label: '解锁'
        },
      ],

      currencyList: [],
    }
  },
  created() {
    let that = this;
    this.getConfigSymbolRank ();
    
  },
  watch: {
    amountCurrency() {
      this.selectUserLockInfoByRules();
    }
  },
  methods: {
    //获取数据
    selectUserLockInfoByRules() {
      this.isLoadings = true;
      let param = {
        pageNo: this.pageNo,
        pageSize: this.pageSize,
        'assetCode': this.amountCurrency,
      }
      service.tradeLockingRewardList(param).then(data => {
        this.isLoadings = false;
        if (data.code == window.CODE.SUCCESS) {
          // console.log(data);
          this.list = data.data.list;
          this.pageNum = data.data.pageNum;
        } else {
          window.error(data.msg)
        }
      })
    },

    getConfigSymbolRank () {
      service.getConfigSymbolRank().then(data => {
        if (data.code == window.CODE.SUCCESS) {
          this.currencyList = data.data;
          this.amountCurrency = data.data[0].assetCode2;
        } else {
          window.error(data.msg)
        }
      })
    },
    //翻页
    changePage(val) {
      this.pageNo = val;
      this.selectUserLockInfoByRules();
    }
  }
})